<?php

namespace App\Models;

use App\Helpers\Api\MyCacheTrait;

class Category extends Base
{
    use MyCacheTrait;

    public $timestamps = false;

    public $table = 'category';

    public function child() {
        return $this->hasMany(Category::class, 'parent_id');
    }

    public function getFilePathAttribute($val) {
        if (strpos($val, 'http') === false)
            return env('QINIU_URL') . "/" . $val;
        else
            return $val;
    }


}
